#@adminLayout()
#define main()
<main class="app-content">
    <div class="app-title">
        <div>
            <h1><i class="fa fa-th-list"></i>用户管理</h1>
            <p>网站用户信息管理</p>
        </div>
        <ul class="app-breadcrumb breadcrumb">
            <li class="breadcrumb-item"><a href="/admin"><i class="fa fa-home fa-lg"></i>仪表盘</a></li>
            <li class="breadcrumb-item active"><a href="/admin/user">用户管理</a></li>
        </ul>
    </div>

    <div class="row">
        <div class="clearfix"></div>
        <div class="col-md-12">
            <div class="tile">
                <div class="tile-body">
                    <!--<form class="row" action="/admin/user" method="get">-->
                        <!--<div class="form-group col-md-3">-->
                            <!--<input class="form-control" type="text" autocomplete="off" name="q" required="required" placeholder="请输入用户名">-->
                        <!--</div>-->
                        <!--<div class="form-group col-md-4 align-self-end">-->
                            <!--<button class="btn btn-primary" type="button"><i class="fa fa-fw fa-lg fa-search"></i>查询-->
                            <!--</button>-->
                        <!--</div>-->
                    <!--</form>-->
                    <a class="btn btn-danger btn-sm" href="/admin/user/sendAllUser"
                       title="发送消息"><i class="fa fa-lg fa-book">发送全体消息</i></a>
                </div>
            </div>
        </div>
        <div class="col-md-12">
            <div class="tile">
                <div class="table-responsive">
                    <table class="table table-bordered">
                        <thead>
                        <tr>
                            <th>昵称</th>
                            <th>邮箱</th>
                            <th>锁定</th>
                            <th>威望</th>
                            <th>积分</th>
                            <th>是否认证</th>
                            <th>是否VIP</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        #for(x : userPage.getList())
                        <tr>
                            <td>#(x.nickName)</td>
                            <td>#(x.email)</td>
                            <td>
                                #if(x.isStatusReg())
                                未激活
                                #else
                                <div class="toggle lg"><label>
                                    <input data-id="#(x.uid)" type="checkbox"
                                           #if(x.isStatusReg()) disabled #end
                                           #if(x.isStatusLockId()) checked #end
                                           class="mgc-switch mgc-tiny"><span class="button-indecator"></span></label>
                                </div>
                                #end
                            </td>
                            <td>#(x.prestige)</td>
                            <td>#(x.points)</td>
                            <td>
                                #if(x.isAuthOk())
                                <button class="btn btn-info btn-sm" type="button" disabled="">ON</button>
                                #elseif(x.isAuthNo())
                                <button class="btn btn-secondary btn-sm" type="button" disabled="">OFF</button>
                                #elseif(x.isAuthFa())
                                <button class="btn btn-danger btn-sm" type="button" disabled="">审核</button>
                                #end
                            </td>
                            <td>
                                #if(x.isVipYes())
                                <button class="btn btn-info btn-sm" type="button" disabled="">ON</button>
                                #end
                                #if(x.isVipNo())
                                <button class="btn btn-secondary btn-sm" type="button" disabled="">OFF</button>
                                #end
                            </td>
                            <td>
                                <a class="btn btn-info btn-sm"
                                   href="/admin/user/userEdit?id=#(x.uid)&p=#(userPage.pageNumber)" title="修改"><i
                                        class="fa fa-lg fa-edit">修改</i></a>
                                <a class="btn btn-warning btn-sm" href="/user/detail/#(x.uid)" target="_blank"
                                   title="查看"><i class="fa fa-lg fa-eye">查看</i></a>
                                <a class="btn btn-success btn-sm" href="/admin/user/assignRoles?id=#(x.uid)"
                                   title="分配角色"><i class="fa fa-lg fa-cog">权限</i></a>
                                <a class="btn btn-danger btn-sm" href="/admin/user/sendUser?id=#(x.uid)"
                                   title="发送消息"><i class="fa fa-lg fa-book">发送消息</i></a>
                                <a class="btn btn-primary btn-sm" href="javascript:;" onclick="confirmDelete('确定要重置密码吗？', '/admin/user/setUserPass?id=#(x.uid)');" ><i class="fa fa-lg fa-book">重置密码</i></a>
                            </td>
                        </tr>
                        #end
                        </tbody>
                    </table>
                    <div>
                        #@adminPaginate(userPage.pageNumber, userPage.totalPage, "/admin/user?p=")
                    </div>
                </div>
            </div>
        </div>
    </div>
</main>
#end

#define js()
<script type="text/javascript">
    $(document).ready(function () {
        initMagicInput(prepareAction);

    });

    function prepareAction($this, state) {
        return {
            url: state ? "/admin/user/lock" : "/admin/user/unlock",
            data: {
                id: $this.attr("data-id")
            }
        }
    }
</script>
#end